<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //扩展运算符的应用

        //1.数组合并
        let arr1 = ['a', 'b', 'c']
        let arr2 = ['d', 'e']
        let res1 = arr1.concat(arr2) //ES5方法
        console.log(res1)
        let res2 = [...arr1, ...arr2] //ES6方法
        console.log(res2)

        //2.数组克隆（浅拷贝）
        let res3 = [...res2]
        console.log(res3)

        //3.将伪数组转为真正的数组
        let divs = document.querySelectorAll('div')
        console.log(divs)
        let divArr = [...divs]
        console.log(divArr)
    </script>
</body>
</html>